home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
gnu
/
nihcl-30.lha
/
nihcl-3.0
/
vectest
/
doublevec.v
< prev
next >
Wrap
Text File
|
1990-05-16
|
6KB
|
87 lines
Test IntVec and DoubleVec
IntVec I(3,1,2): 1 3 5
DoubleVec A(10,1.0): 1 2 3 4 5 6
7 8 9 10
DoubleVec B(10,10.0,-1.0): 10 9 8 7 6 5
4 3 2 1
DoubleVec T(A): 1 2 3 4 5 6
7 8 9 10
DoubleVec U(A(0,5,2)): 1 3 5 7 9
C = U: 1 3 5 7 9
C = C: 1 3 5 7 9
C = A(0,5,2): 1 3 5 7 9
C = A; C = C(0,5,2): 1 3 5 7 9
C = A[A>B]: 6 7 8 9 10
C = A; C = C[C>B]: 6 7 8 9 10
C = A[I]: 2 4 6
C = A; C = C[I]: 2 4 6
C = 0.: 0 0 0
C = A; C(0,5,2) = DoubleVec(5,-1.,0.): -1 2 -1 4 -1 6
-1 8 -1 10
C(1,5,2) = C(0,5,2): -1 -1 -1 -1 -1 -1
-1 -1 -1 -1
C(0,3,1) = A[I]: 2 4 6 -1 -1 -1
-1 -1 -1 -1
C(3,3,1) = A[A<=3.]: 2 4 6 1 2 3
-1 -1 -1 -1
C(0,6,1) = 0.: 0 0 0 0 0 0
-1 -1 -1 -1
C = -A: -1 -2 -3 -4 -5 -6
-7 -8 -9 -10
C++: 0 -1 -2 -3 -4 -5
-6 -7 -8 -9
C = A-B: -9 -7 -5 -3 -1 1
3 5 7 9
C = A-1: 0 1 2 3 4 5
6 7 8 9
C = 1.+A: 2 3 4 5 6 7
8 9 10 11
A>B: 0 0 0 0 0 1 1 1 1 1
A<=5.: 1 1 1 1 1 0 0 0 0 0
5.<A: 0 0 0 0 0 1 1 1 1 1
C = A; C += A: 2 4 6 8 10 12
14 16 18 20
C -= 1.: 1 3 5 7 9 11
13 15 17 19
C = A; C[I] = DoubleVec(3,-1.,0.): 1 -1 3 -1 5 -1
7 8 9 10
C[I] = A[I]: 1 2 3 4 5 6
7 8 9 10
C[I] = A[A<=3.]: 1 1 3 2 5 3
7 8 9 10
C[I] = A(0,3,2): 1 1 3 3 5 5
7 8 9 10
C[I] = -1.: 1 -1 3 -1 5 -1
7 8 9 10
C = A[I]+B[I]: 11 11 11
C = A; C[A<=5.] = DoubleVec(5,-1.,0.): -1 -1 -1 -1 -1 6
7 8 9 10
C = A; C[A<=3.] = A[I]: 2 4 6 4 5 6
7 8 9 10
C = A; C[A<=5.] = B[A<=5.]: 10 9 8 7 6 6
7 8 9 10
C = A; C[A<=5.] = A(0,5,1): 1 2 3 4 5 6
7 8 9 10
C = A; C[A<=5.] = 0.: 0 0 0 0 0 6
7 8 9 10
C = A[A<=5.] + B[B<=5.]: 6 6 6 6 6
abs(DoubleVec(10,-5)): 5 4 3 2 1 0
1 2 3 4
atan2(DoubleVec(10,1),DoubleVec(10,10,-1)): 0.099669 .21867 .35877 .51915 .69474 .87606
1.0517 1.212 1.3521 1.4711
pow(DoubleVec(10,1),DoubleVec(10,2,0)): 1 4 9 16 25 36
49 64 81 100
cumsum(DoubleVec(10,1)): 1 3 6 10 15 21
28 36 45 55
delta(cumsum(DoubleVec(10,1))): 1 2 3 4 5 6
7 8 9 10
dot(A,B): 220
max(A): 9
min(A): 0
prod(A): 3.6288e+06
reverse(A): 10 9 8 7 6 5
4 3 2 1
sqrt(A): 1 1.4142 1.7321 2 2.2361 2.4495
2.6458 2.8284 3 3.1623
sum(A): 55